package com.guigu.qingcheng.service;

import com.guigu.common_util.pojo.utils.Result;
import com.guigu.qingcheng.entity.TbAddress;
import com.guigu.qingcheng.entity.TbUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Component
@FeignClient("service-user")
public interface UserService {

    /**
     * 根据用户名查询地址列表
     * @return
     */
    @GetMapping("/service_user/tb-address/findAddressList")
    public List<TbAddress> findAddressList(@RequestParam("username") String username);

    /**
     * 根据手机号发送验证码
     * @param phone
     * @return
     */
    @GetMapping("/serviceuser/tb-user/sendMsm")
    public Result sendMsm(@RequestParam("phone") String phone);

    /**
     * 注册
     * @param user
     * @param smsCode
     * @return
     */
    @PostMapping("/serviceuser/tb-user/save")
    public Result save(@RequestBody TbUser user,@RequestParam("smsCode") String smsCode);

    /**
     * 登录
     * @param user
     * @return
     */
    @PostMapping("/serviceuser/tb-user/login")
    public Result loginUser(@RequestBody TbUser user);

    // 根据token获取用户信息
    @GetMapping("/serviceuser/tb-user/getUserInfo")
    public Result getUserInfo(@RequestParam("username") String username);


    // 生成微信扫描的二维码
    @GetMapping("/api/ucenter/wx/login")
    public String getWxCode();

}
